﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FazaDemo.QL.AbstractQueryModel;
using FazaDemo.ViewModels;
using FazaDemo.Data;

namespace FazaDemo.QueryModel
{
    public class PlaceViewRepository : IQueryRepository<object, PlaceViewModel>
    {
        public IList<PlaceViewModel> Get()
        {
            using (var context = new FazaEntities1())
            {
                var places = context.Set<TS_DISTRICT>().ToList();
                return places.Select(p => new PlaceViewModel
                {
                    Id = p.ID, 
                    Name = p.NM, 
                    AltName = p.NM_ALT, 
                    SocialName = p.NM_SOC, 
                    IsVirtual = p.IsVirtual
                }
                ).ToList();
            }
        }

        public PlaceViewModel Get(object context)
        {
            return default(PlaceViewModel);
        }
    }
}
